<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html>
<!-- saved from url=(0038)http://192.168.0.77/pms/idea_show.html -->
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.js"></script>
	<script type="text/javascript" src="js/bootstrap-modal.js"></script>
	<script type="text/javascript" src="js/bootstrap-transition.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
				
				$("#editComment").click(function(){
				    $('#myModal').modal(option);
				});
				
				$("#btn").click(function(){
					$("#myform").submit();
				});
		});
	</script>
</head>
<body class="body">
	<jsp:include page="include/head.jsp">
		<jsp:param value="${ep}" name="ep"/>
	</jsp:include>
	
	
	<div class="container">
	  <div class="row">
		<div class="span3">
			<div style="padding: 8px 0;" class="well">
				<jsp:include page="include/nav.jsp">
					<jsp:param value="idea" name="tag"/>
				</jsp:include>
			</div>
		</div>
		<div class="span9">
			<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:15px">
				<li class="active">
					<a href="idea.jspx?p=${p}"><i class="icon-fire"></i>想法</a>&gt;${idea.title}
				</li>
				
			</ul>
			<div class="wall">
				  <div class="page-header">
					  <img src="${ep.e.picture }" style="">:
					  <h3>${idea.title}&nbsp;&nbsp;<small>${idea.e.name}发布于 ${idea.tiptime}</small>
					  		<!-- 只有发布该想法的本人 且在5分钟之内 且没有评论的时候才有该编辑功能 -->
					  		<c:if test="${ep.e.name==idea.e.name}">
						  		<c:if test="${idea.longtime<=300}">
							 	 	<c:if test="${fn:length(commentsList)==0}">
										<a style="margin-left:230px;" id="editComment" href="#myModal" data-toggle="modal" data-backdrop="false" title="编辑"><i class="icon-pencil"></i>编辑</a>
									</c:if>	
								</c:if>
							</c:if>
							<c:if test="${ep.e.zhiwei=='管理员'}">
								 <a style="margin-left:20px;"  href="idea.jspx?m=delIdea&ideaId=${idea.id}&p=${pager.pageNum}" title="删除"><i class="icon-trash">删除</i></a>
							</c:if>
					  </h3>
					 <p>${idea.content}</p>
					  <!-- 弹出编辑窗口 -->
						<div class="modal fade" id="myModal" class="modal hide fade" >
							<div class="modal-header">
								<a class="close" data-dismiss="modal">×</a>
								<h3>编辑想法</h3>
							</div>
							<div class="modal-body">
								<form action="idea.jspx" method="post" id="myform">
								        <fieldset>
								        	<input type="hidden" name="m" value="editIdea">
								        	<input type="hidden" name="p" value="${p}">
								        	<input type="hidden" name="ideaId" value="${idea.id}">
									        <div class="control-group">
									            <label class="control-label" for="input01">标题</label>
									            <div class="controls">
								            		<input type="text" name="title" id="input01" style="width:520px;"  value="${idea.title}">
								           		</div>
								            </div>
										  <div class="control-group">
								            <label class="control-label" for="input01">内容</label>
								            <div class="controls">
								              <textarea name="content" id="" style="width:520px;" rows="8">${idea.content}</textarea>
								            </div>
								          </div>
								        </fieldset>
							      </form>          
							</div>
							<div class="modal-footer">
								<button type="button" id="btn" class="btn btn-primary">保存修改</button>
								<a class="btn" data-dismiss="modal" href="#">关闭</a>
							</div>
						</div>
				  </div>
				  <div class="line">
					<span style="font-size:18px;">发表评论:</span>
				  </div>
				  <form action="idea.jspx" method="post">
				  	<input type="hidden" name="m" value="saveIdeaComment">
				  	<input type="hidden" name="ideaId" value="${idea.id}">
				  	<input type="hidden" name="p" value="${p}">
					<textarea name="content" id="" class="span6" rows="4"></textarea>
					<br>
					<button class="btn btn-primary" type="submit">发布</button>
				  </form>
				 <c:if test="${fn:length(commentsList) == 0 }">
					<blockquote>
					  	没有评论！
					</blockquote>
				 </c:if>
				 <div class="line">
					评论列表：
				  </div>
				 <c:forEach items="${commentsList}" var="comment">
					 <blockquote>
				 		<img src="${comment.e.picture }" style="">:
					  	<p>${comment.content};</p>
					  	<small>
							${comment.e.name}发布于 ${comment.tiptime}
							<c:if test="${ep.e.zhiwei=='管理员'}">
							    <i class="icon-trash"></i><a href="idea.jspx?m=delComment&ideaCommentId=${comment.id}&p=${p}"  title="删除"></a>
							</c:if>
						 </small>
					</blockquote>
				</c:forEach>
				<a href="idea.jspx?p=${p}">←返回想法列表</a>
			</div>
		</div>
	  </div>
	</div>

</body></html>